<%
Dim conn
Dim rs
Dim Redir
Dim sqlcount
Dim getcount
xuid=request.form.item("xuid")

subvalue=request.form.item("submit")
F_ID = Request.Form.Item("F_ID")
F_CODE = Request.Form.Item("F_CODE")
F_NAME = Request.Form.Item("F_NAME")
F_ADDRESS = Request.Form.Item("F_ADDRESS")
F_TEL_NUMBER = Request.Form.Item("F_TEL_NUMBER")
F_OSTAN = Request.Form.Item("F_OSTAN")
F_SHAHRESTAN = Request.Form.Item("F_SHAHRESTAN")

F_ID = Replace(F_ID,"'","")
F_CODE = Replace(F_CODE,"'","")
F_NAME = Replace(F_NAME,"'","")
F_ADDRESS = Replace(F_ADDRESS,"'","")
F_TEL_NUMBER = Replace(F_TEL_NUMBER,"'","")
F_OSTAN = Replace(F_OSTAN,"'","")
F_SHAHRESTAN = Replace(F_SHAHRESTAN,"'","")
set conn = Server.Createobject("ADODB.Connection")
set  rs = Server.Createobject("ADODB.Recordset")
ConnStr = "DSN=dbpr_sql;UID=sa;PWD=hhhhhhhh;"
conn.Mode = 3
conn.Open (ConnStr)
sqlcount = "SELECT MAX() as numlines FROM WAREHOUSE"
set rs = conn.execute(sqlcount)
getcount = rs.fields("numlines")
Session("tablecount") = Session("tablecount") 
Session("Tablename") = Session("Tablename") 
Session("fieldname") = Session("fieldname")
SQL="UPDATE WAREHOUSE  SET ID = " & F_ID & "," & "CODE = " & "'" & F_CODE & "'" & "," & "NAME = " & "'" & F_NAME & "'" & "," & "ADDRESS = " & "'" & F_ADDRESS & "'" & "," & "TEL_NUMBER = " & "'" & F_TEL_NUMBER & "'" & "," & "OSTAN = " & "'" & F_OSTAN & "'" & "," & "SHAHRESTAN = " & "'" & F_SHAHRESTAN & "'"  &   " WHERE  = " & xuid
IF subvalue=trim("Delete all data") then
SQL = "DELETE FROM WAREHOUSE WHERE   = " & xuid
Redir="UPD_WAREHOUSE1.asp"
Else
Redir="UPD_WAREHOUSE1.asp?fuid=" & xuid
End if
set rs = conn.execute(SQL)
conn.close
set rs = Nothing
set conn = Nothing
Response.redirect(Redir)
%>
